package com.umeox.ota.mvvm.viewModel;

import android.app.Application;
import androidx.databinding.ObservableBoolean;

import com.umeox.ota.mvvm.BaseViewModel;
import com.umeox.ota.mvvm.model.MainModel;
import com.abupdate.fotainject.FotaInject;
import com.abupdate.fotainject.FotaInjector;
import com.abupdate.iot_libs.engine.policy.PolicyManager;
import com.abupdate.sdk_annotation.Inject;


/**
 * @author fighter_lee
 * @date 2018/7/19
 */
public class SetViewModel extends BaseViewModel<MainModel> {
    private static final String TAG = "SetViewModel";

    private FotaInject fotaInject;

    @Inject
    PolicyManager policyManager;

    public final ObservableBoolean onlyWifiDownload = new ObservableBoolean();
    public final ObservableBoolean installForce = new ObservableBoolean();

    public SetViewModel(Application application, MainModel model) {
        super(application, model);
        fotaInject = FotaInjector.inject(this);
        initData();
    }

    protected void initData() {
        onlyWifiDownload.set(policyManager.getPolicyConfig().wifi);
        installForce.set(policyManager.getPolicyConfig().install_force);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        fotaInject.unInject();
    }
}
